<html>
<head><meta charset="utf-8"><title>State of inlining with ThinLTO · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/State.20of.20inlining.20with.20ThinLTO.html">State of inlining with ThinLTO</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="177143703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/State%20of%20inlining%20with%20ThinLTO/near/177143703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tatsuyuki Ishi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/State.20of.20inlining.20with.20ThinLTO.html#177143703">(Oct 02 2019 at 12:14)</a>:</h4>
<p>I have been wondering recently if we could rely solely on ThinLTO for all inlining - that should work (from my understanding) with the exception of when dylibs are used (e.g. rustc).<br>
So far I think all <code>#[inline]</code> imports are codegen-ed at downstream crates. Is my understanding correct and do you think the above idea is worth implementing?</p>



<a name="177144005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/State%20of%20inlining%20with%20ThinLTO/near/177144005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/State.20of.20inlining.20with.20ThinLTO.html#177144005">(Oct 02 2019 at 12:18)</a>:</h4>
<p>One way of experimenting with this without too much upfront implementation effort would be to modify the compiler to not duplicate inline functions across codegen units and then do performance tests with different numbers of codegen units.</p>



<a name="177144107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/State%20of%20inlining%20with%20ThinLTO/near/177144107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/State.20of.20inlining.20with.20ThinLTO.html#177144107">(Oct 02 2019 at 12:20)</a>:</h4>
<p>I suspect that ThinLTO can't quite reach the same runtime performance, but it might be worth a try.</p>



<a name="177144174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/State%20of%20inlining%20with%20ThinLTO/near/177144174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/State.20of.20inlining.20with.20ThinLTO.html#177144174">(Oct 02 2019 at 12:21)</a>:</h4>
<p>I could imagine <code>-Copt-level=2</code> doing only ThinLTO while <code>-Copt-level=3</code> would do the code duplication.</p>



<a name="177144681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/State%20of%20inlining%20with%20ThinLTO/near/177144681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tatsuyuki Ishi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/State.20of.20inlining.20with.20ThinLTO.html#177144681">(Oct 02 2019 at 12:28)</a>:</h4>
<p>I think that logic is implemented <a href="https://github.com/rust-lang/rust/blob/f2023ac599c38a59f86552089e6791c5a73412d3/src/librustc_mir/monomorphize/item.rs#L65" target="_blank" title="https://github.com/rust-lang/rust/blob/f2023ac599c38a59f86552089e6791c5a73412d3/src/librustc_mir/monomorphize/item.rs#L65">here</a> but for non-optimized builds. Should I try having a build with this line changed?</p>



<a name="177148898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/State%20of%20inlining%20with%20ThinLTO/near/177148898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tatsuyuki Ishi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/State.20of.20inlining.20with.20ThinLTO.html#177148898">(Oct 02 2019 at 13:22)</a>:</h4>
<p>Actually there's a debugging opt so I can just do lolbench</p>



<a name="177202979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/State%20of%20inlining%20with%20ThinLTO/near/177202979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tatsuyuki Ishi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/State.20of.20inlining.20with.20ThinLTO.html#177202979">(Oct 02 2019 at 23:39)</a>:</h4>
<p>I'm abandoning lolbench since it keeps refusing to work, if anyone know a good alternative or whatever please let me know</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>